Trim Text Action Icon

Trim Text

Declaration

<AMTEXTREMOVE TEXT="text" REMOVE="text" CHARACTERS="text" ACTION="text [options]" RESULTVARIABLE="text [varibable name]">

See Also

Create Variable Send Keystrokes

Description

Removes characters from the beginning and/or end of the specified text and places the result in a variable..

Practical Usage

Text manipulation. Used to take spaces off of the beginning or end of a value text value. These spaces can sometimes be cause by data-entry error or a formatting routines from external applications.

Parameters

General Tab

Text to Remove from
Text, Required
MARKUP: TEXT="    text padded with spaces "

Specifies the text to trim.  

Remove from
Text [options], Optional (default: beginning and end)
MARKUP: ACTION="remove_beginning"

Specifies how the text is trimmed.

The available options are:

beginning and end: The text is stripped from the beginning and end of the target text.

beginning: The text is stripped from the beginning of the target text.

end: The text is stripped from the end of the target text.

Remove
Text [options], Optional - Default: Whitespace
MARKUP: REMOVE="returns"

Specifies the character(s) to remove from the string.

The available options are:

whitespace: All whitespace characters are removed from the string

carriage returns: Carriage returns are removed from the string

spaces: spaces are removed from the string

tabs: tabs are removed from the string

User Defined: The text specified in the "Characters to Remove" parameter are removed from the string.

Characters to Remove
Text, Required if Remove is "user"
MARKUP: CHARACTERS="x"

If Remove is set to User Defined, specifies the user defined characters to remove..

Populate Variable with Result
Text [variable name], Required
MARKUP: RESULTVARIABLE="varname"

Specifies the variable to receive the new formatted value.

Notes

Using Variables
All variables must be created before they can be used. This is done using the
Create Variable <AMVARIABLE> action. Once created, variables can be set using the Set Variable <AMSET> action, or by certain actions that support populating variables. To get data out of the variables, in any action parameter, simply surround the variable name with percentage % signs (e.g. %varname%). Remember not to use percentage signs when specifying the name of a variable to populate, percentage signs are only needed to get data out.

Standard Error Handling Options
This action also includes the standard "Error Causes" and "On Error" failure handling options/tabs

More on Error Handling Options

Variables and Expressions
All text fields allow the use of expressions by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, a popup expression builder is available in all these fields by pressing F2.
More on variables...

More on expressions...

More on the expression builder...

Example

<AMVARIABLE NAME="thevariable">  this text has spaces on the front</AMVARIABLE>
<AMMESSAGEBOX>%thevariable%</AMMESSAGEBOX>
<AMTEXTREMOVE TEXT="%thevariable%" RESULTVARIABLE="thevariable">
<AMMESSAGEBOX>%thevariable%</AMMESSAGEBOX>